function initToken(option) {
    try {
        let token = getToken();
        if (token) {
            option.headers.token = token;
        }
    }
    catch (error) {
        console.error(`添加token`, error);
    }
    finally {
        // eslint-disable-next-line
        return option;
    }
}
function getToken() {
    let _search = new URLSearchParams(location.hash.substr(2));
    let _search1 = new URLSearchParams(location.search);
    return _search.get('token') || _search1.get('token') || '';
}
export default initToken;
export { getToken, initToken };
